package com.tensquare.article.controller;

import com.tensquare.article.pojo.Comment;
import com.tensquare.article.service.CommentService;
import entity.Result;
import entity.StatusCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author Macross
 * @Type CommentController.java
 * @Desc
 * @date 2019/12/18 19:44
 */
@RestController
@RequestMapping("/comment")
@CrossOrigin(allowCredentials = "true")
public class CommentController {

    @Autowired
    private CommentService commentService;

    @GetMapping("/article/{articleId}")
    public Result<List<Comment>> findByArticleId(@PathVariable String articleId){
        return new Result<>(true,StatusCode.OK,"查询成功",commentService.findByArticleId(articleId));
    }
}
